export const TICKE_KEY_MAP = {
  parkingLotName: '停车路段',
  spotId: '停车泊位',
  plateNumber: '车牌号码',
  vehicleType: '车辆类型',
  inTime: '驶入时间',
  cashier: '收费员工号',
  chargeParty: '收费单位',
  parkType: '订单类型',
  chargeCodeQueryKey: '收费二维码查询参数',
  chargeCode: '收费二维码',
  officialCode: '公众号二维码',
  officialText: '公众号文字',
  disclaimer: '免责声明',
  serviceTel: '客服电话',
  headerTitle: '小票标题',
  chargeCodeTitle: '收费二维码标题',
  printKeyOrder: '打印字段顺序',
  printTime: '打印时间',
  plateArrear: '历史欠费',
};
export const DEFAULT_PRINT_KEY_ORDER: PrintKeyItem[] = [
  {
    key: 'parkingLotName',
    title: '停车点',
    enable: true,
  },
  {
    key: 'spotId',
    title: '泊位号',
    enable: true,
  },
  {
    key: 'plateNumber',
    title: '车牌号',
    enable: true,
  },
  {
    key: 'vehicleType',
    title: '车类型',
    enable: true,
  },
  {
    key: 'inTime',
    title: '开始时间',
    enable: true,
  },
  {
    key: 'printTime',
    title: '打印时间',
    enable: true,
  },
  {
    key: 'cashier',
    title: '收费人员',
    enable: true,
  },
  {
    key: 'chargeParty',
    title: '收费单位',
    enable: true,
  },
  {
    key: 'parkType',
    title: '停车类型',
    enable: true,
  },
  {
    key: 'chargeCodeTitle',
    title: '收费二维码标题',
    enable: true,
  },
  {
    key: 'chargeCode',
    title: '收费二维码',
    enable: true,
  },
  {
    key: 'officialCode',
    title: '微信公众号二维码',
    enable: true,
  },
  {
    key: 'officialText',
    title: '微信公众号描述文字',
    enable: true,
  },
  {
    key: 'disclaimer',
    title: '免责声明',
    enable: true,
  },
  {
    key: 'serviceTel',
    title: '客服电话',
    enable: true,
  },
  {
    key: 'plateArrear',
    title: '历史欠费',
    enable: true,
  },
];

export const DEFAULT_TICKET_CONTENT = {
  parkingLotName: '某某路段',
  spotId: 'xxxxxxxx',
  plateNumber: '浙A12345',
  vehicleType: '小型车',
  inTime: '2022-06-27 06:26:20',
  printTime: '2022-06-27 06:26:20',
  cashier: '700001',
  chargeParty: '某某有限公司',
  parkType: '普通停车',
  chargeCodeQueryKey: 'orderNo',
  chargeCode: 'https://',
  officialCode: '',
  officialText: '',
  disclaimer: '',
  serviceTel: '',
  headerTitle: 'XXXX机动车停车凭证',
  chargeCodeTitle: '微信/支付宝',
  printKeyOrder: '',
  plateArrear: '0.00 元，0笔',
};

export const getPrintKeyArr = (printKeyOrder: string) => {
  const tempObj: Record<string, PrintKeyItem> = JSON.parse(printKeyOrder);
  const arr: PrintKeyItem[] = [];
  for (const key in tempObj) {
    arr[Number(key)] = tempObj[key];
  }
  return arr;
};

export const getPrkingKeyMap = (arr: PrintKeyItem[]) => {
  const obj: Record<string, PrintKeyItem> = {};
  arr.forEach((item, index) => {
    obj[index] = item;
  });
  return JSON.stringify(obj);
};
